<template>
	<view class="smart-page">
		<view class="smart-page-head">
			<view class="smart-page-head-title">Slider 滑块控制器</view>
			<view class="smart-page-head-subtitle">多种滑块样式与功能展示</view>
		</view>
		
		<view class="smart-padding-wrap">
			<!-- 显示当前值 -->
			<view class="slider-section">
				<view class="section-header">
					<view class="section-title">
						<text class="section-icon">🎯</text>
						<text class="section-text">显示当前值</text>
					</view>
					<view class="section-desc">实时显示滑块当前数值</view>
				</view>
				<view class="slider-card">
					<slider value="50" @change="sliderChange" show-value 
							class="custom-slider" 
							activeColor="#667eea" 
							backgroundColor="#e9ecef"
							block-color="#667eea"
							block-size="24" />
				</view>
			</view>

			<!-- 步进设置 -->
			<view class="slider-section">
				<view class="section-header">
					<view class="section-title">
						<text class="section-icon">⚡</text>
						<text class="section-text">步进设置</text>
					</view>
					<view class="section-desc">设置步进值为5，实现跳跃式滑动</view>
				</view>
				<view class="slider-card">
					<view class="slider-value-display">当前值: 60</view>
					<slider value="60" @change="sliderChange" step="5"
							class="custom-slider step-slider"
							activeColor="#4cd964" 
							backgroundColor="#e9ecef"
							block-color="#4cd964"
							block-size="20" />
					<view class="step-markers">
						<text class="step-marker" v-for="step in [0, 20, 40, 60, 80, 100]" :key="step">{{step}}</text>
					</view>
				</view>
			</view>

			<!-- 范围设置 -->
			<view class="slider-section">
				<view class="section-header">
					<view class="section-title">
						<text class="section-icon">📊</text>
						<text class="section-text">范围设置</text>
					</view>
					<view class="section-desc">自定义最小值50，最大值200</view>
				</view>
				<view class="slider-card">
					<slider value="100" @change="sliderChange" min="50" max="200" show-value
							class="custom-slider range-slider"
							activeColor="#ff9500" 
							backgroundColor="#e9ecef"
							block-color="#ff9500"
							block-size="22" />
					<view class="range-labels">
						<text class="range-label">50</text>
						<text class="range-label">200</text>
					</view>
				</view>
			</view>

			<!-- 自定义样式 -->
			<view class="slider-section">
				<view class="section-header">
					<view class="section-title">
						<text class="section-icon">🎨</text>
						<text class="section-text">自定义样式</text>
					</view>
					<view class="section-desc">个性化颜色和尺寸设置</view>
				</view>
				<view class="slider-card">
					<slider value="50" @change="sliderChange" 
							activeColor="#FFCC33" 
							backgroundColor="#000000" 
							block-color="#8A6DE9" 
							block-size="20"
							class="custom-slider custom-style-slider" />
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			sliderChange(e) {
				console.log('value 发生变化: ' + e.detail.value)
				uni.showToast({
					title: `当前值: ${e.detail.value}`,
					icon: 'none',
					duration: 1000
				})
			}
		}
	};
</script>

<style>
	.smart-page {
		background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
		min-height: 100vh;
		padding: 30rpx;
	}
	
	.smart-page-head {
		text-align: center;
		margin-bottom: 60rpx;
		padding: 40rpx 0;
	}
	
	.smart-page-head-title {
		font-size: 48rpx;
		font-weight: 700;
		color: #2c3e50;
		margin-bottom: 16rpx;
		background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
		-webkit-background-clip: text;
		-webkit-text-fill-color: transparent;
		background-clip: text;
	}
	
	.smart-page-head-subtitle {
		font-size: 28rpx;
		color: #7f8c8d;
		font-weight: 400;
	}
	
	.slider-section {
		margin-bottom: 50rpx;
	}
	
	.section-header {
		margin-bottom: 30rpx;
		padding: 0 20rpx;
	}
	
	.section-title {
		display: flex;
		align-items: center;
		margin-bottom: 12rpx;
	}
	
	.section-icon {
		font-size: 36rpx;
		margin-right: 20rpx;
	}
	
	.section-text {
		font-size: 36rpx;
		font-weight: 600;
		color: #2c3e50;
	}
	
	.section-desc {
		font-size: 26rpx;
		color: #95a5a6;
		padding-left: 56rpx;
	}
	
	.slider-card {
		background: #ffffff;
		border-radius: 24rpx;
		padding: 40rpx 30rpx;
		box-shadow: 0 8rpx 40rpx rgba(0, 0, 0, 0.08);
		backdrop-filter: blur(20rpx);
		border: 1rpx solid rgba(255, 255, 255, 0.2);
	}
	
	.custom-slider {
		width: 100%;
		margin: 20rpx 0;
	}
	
	.slider-value-display {
		text-align: center;
		font-size: 28rpx;
		color: #667eea;
		font-weight: 600;
		margin-bottom: 30rpx;
		padding: 12rpx 20rpx;
		background: #f8f9ff;
		border-radius: 12rpx;
		border: 1rpx solid #e1e8ff;
	}
	
	.step-markers {
		display: flex;
		justify-content: space-between;
		margin-top: 20rpx;
		padding: 0 10rpx;
	}
	
	.step-marker {
		font-size: 22rpx;
		color: #95a5a6;
		font-weight: 500;
	}
	
	.range-labels {
		display: flex;
		justify-content: space-between;
		margin-top: 20rpx;
		padding: 0 10rpx;
	}
	
	.range-label {
		font-size: 24rpx;
		color: #ff9500;
		font-weight: 600;
	}
	
	.style-info {
		display: flex;
		align-items: center;
		justify-content: center;
		flex-wrap: wrap;
		margin-top: 30rpx;
		gap: 20rpx;
	}
	
	.color-dot {
		width: 24rpx;
		height: 24rpx;
		border-radius: 50%;
		border: 2rpx solid #fff;
		box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.2);
	}
	
	.color-label {
		font-size: 24rpx;
		color: #7f8c8d;
		margin-right: 20rpx;
	}
	
	/* 滑块悬停效果 */
	.custom-slider:hover {
		opacity: 0.9;
	}
	
	
	@media (max-width: 750rpx) {
		.smart-page {
			padding: 20rpx;
		}
		
		.slider-card {
			padding: 30rpx 20rpx;
		}
		
		.style-info {
			flex-direction: column;
			gap: 15rpx;
		}
	}
</style>